renaming to bpph
[ppastats.git] / src / lp.h
1 /*
2  * Copyright (C) 2011-2012 jeanfi@gmail.com
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License as
6  * published by the Free Software Foundation; either version 2 of the
7  * License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17  * 02110-1301 USA
18  */
19
20 #ifndef _PPASTATS_LP_H_
21 #define _PPASTATS_LP_H_
22
23 #define URL_BASE_LP "https://api.launchpad.net/1.0"
24
25 #define _XOPEN_SOURCE
26 #include <time.h>
27
28 struct daily_download_total {
29         int count;
30
31         struct tm date;
32 };
33
34 /* (b)inary (p)ackage (p)ublishing (h)istory */
35 struct bpph {
36         char *binary_package_name;
37         char *binary_package_version;
38         char *distro_arch_series_link;
39         char *self_link;
40         int architecture_specific;
41 };
42
43 struct distro_arch_series {
44         char *display_name;
45         char *title;
46         char *architecture_tag;
47         int is_nominated_arch_indep;
48         char *distroseries_link;
49 };
50
51 struct distro_series {
52         char *displayname;
53         char *name;
54         char *version;
55         char *title;
56 };
57
58 struct distro_series *distro_series_new(const char *name,
59                                         const char *version,
60                                         const char *title,
61                                         const char *displayname);
62
63 void distro_series_free(struct distro_series *distro_series);
64
65 void daily_download_total_list_free(struct daily_download_total **);
66
67 struct distro_arch_series *
68 distro_arch_series_new(const char *display_name,
69                        const char *title,
70                        const char *architecture_tag,
71                        int is_nominated_arch_indep,
72                        const char *distroseries_link);
73
74 void distro_arch_series_free(struct distro_arch_series *);
75
76 void binary_package_publishing_history_free(struct bpph *b);
77
78 struct bpph *
79 binary_package_publishing_history_new(const char *binary_package_name,
80                                       const char *binary_package_version,
81                                       const char *distro_arch_series_link,
82                                       const char *self_link,
83                                       int architecture_specific);
84
85 void binary_package_publishing_history_list_free
86 (struct bpph **list);
87
88
89 char *get_archive_url(const char *owner, const char  *ppa);
90
91 #endif